/**
 * 引入element plus国际化包
 */
import el_zh_cn from 'element-plus/lib/locale/lang/zh-cn'
import el_en from 'element-plus/lib/locale/lang/en'
/**
 * 引入自己配置的翻译对象
 */
import zh_cn from '@/locales/zh-CN'
import en from '@/locales/en'
// 引入i18n官方包
import { createI18n } from 'vue-i18n'

import sysConfig from "@/config"
import tool from '@/utils/tool'
//定义翻译包
const messages = {
	'zh-cn': {
		el: el_zh_cn,
		...zh_cn
	},
	'en': {
		el: el_en,
		...en
	}
}
const i18n = createI18n({
	locale: tool.data.get("APP_LANG") || sysConfig.LANG,
	fallbackLocale: 'zh-cn',
	globalInjection: true,
	messages,
	//解决Uncaught (in promise) SyntaxError: Not available in legacy mode 这个bug
	legacy: false
})

export default i18n;